package com.example.onlineeducation.data.constant

import androidx.annotation.StringDef

/**
 * SimpleDes:
 * Creator: Sindi
 * Date: 2022-01-12
 * UseDes:模板类型

 */
object TopicType {

    @StringDef(Type.TOPIC, Type.EXAM)
    @kotlin.annotation.Retention(AnnotationRetention.SOURCE)
    annotation class Type {
        companion object {

            const val TOPIC = "专题学习"

            const val EXAM = "考试"

        }
    }

    @StringDef(Status.ALL, Status.INCOMPLETE, Status.COMPLETED)
    @kotlin.annotation.Retention(AnnotationRetention.SOURCE)
    annotation class Status {
        companion object {

            const val ALL = "全部"
            const val INCOMPLETE = "未完成"
            const val COMPLETED = "已完成"
        }
    }

    fun getTemplateTypeName(type: String?, status: String?): String {
        return when (type) {
            Type.TOPIC -> when (status) {
                Status.ALL -> ""
                Status.COMPLETED -> "1"
                Status.INCOMPLETE -> "0"
                else -> ""
            }
            Type.EXAM -> when (status) {
                Status.ALL -> "1"
                Status.INCOMPLETE -> "2"
                Status.COMPLETED -> "3"
                else -> ""
            }
            else -> ""
        }
    }
}